package com.hmo.automatic;

import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;

import android.app.Instrumentation;
import android.os.Build;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;


public class PhoneActivity extends AppCompatActivity implements Runnable{

    private PhoneCallManager phoneCallManager;
    private Thread thread;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_phone);
        phoneCallManager = new PhoneCallManager();
        thread = new Thread(this);
    }



    public void accept(View view) {
//        phoneCallManager.answer();
        thread.start();

    }

    @Override
    public void run() {
        Instrumentation instrumentation = new Instrumentation();
        instrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_HEADSETHOOK);
    }
}